//
//  MRMWebViewController.m
//  MeiRiMoney
//
//  Created by 裘启坤 on 13-9-3.
//  Copyright (c) 2013年 MeiRiCai. All rights reserved.
//

#import "MRMWebViewController.h"

@interface MRMWebViewController ()

@end

@implementation MRMWebViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	
	self.WebView.delegate = self;
	
	activityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
	[activityIndicatorView setCenter:self.view.center];
	[activityIndicatorView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];
	[self.view addSubview:activityIndicatorView];
	
    // Do any additional setup after loading the view from its nib.
	NSURL *url = [[NSURL alloc] initWithString:self.UrlString];
	NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
	[self.WebView loadRequest:urlRequest];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidUnload {
	[self setWebView:nil];
	[super viewDidUnload];
}

#pragma mark - WebView Delegate

- (void)webViewDidStartLoad:(UIWebView *)webView
{
	[activityIndicatorView startAnimating];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
	[activityIndicatorView stopAnimating];
}

@end
